﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using RBAC.Web.Models;
using RBAC.Web.Service;
using System.Web.Mvc;

namespace RBAC.Web.Mapper
{ 
      // Mapper for picklist
	public class  FunctionNameMapper
    {	
		public static List<CustomListItem> GetAllFunctionName()
		{
			var result = new List<CustomListItem>();
					result.Add(new CustomListItem() { Value = 1, Text = "Insert" });  			 
					result.Add(new CustomListItem() { Value = 2, Text = "Update" });  			 
					result.Add(new CustomListItem() { Value = 3, Text = "Delete" });  			 
					result.Add(new CustomListItem() { Value = 4, Text = "Search" });  			 
					return result;
		}	

		public static SelectList GetFunctionNameSelectListWithDefault()
        {
            List<CustomListItem> temp = GetAllFunctionName();
            temp.Add(new CustomListItem() { Value = 0, Text = "All" });
            return GetFunctionNameSelectList(temp.OrderBy(s => s.Value).ToList());
        }

        public static SelectList GetFunctionNameSelectList()
        {
            return GetFunctionNameSelectList(GetAllFunctionName());
        }

        private static SelectList GetFunctionNameSelectList(List<CustomListItem> input)
        {
            return new SelectList(input, "Value", "Text");
        }


	}  
	  

}
	
		

	